package com.bjsxt.shop.common.util; 

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bjsxt.shop.common.util.ConstatFinalUtil;
import com.bjsxt.shop.common.util.FileUtil;

public class ConstatFinalUtil
{
	public static Logger LOGGER = LogManager.getLogger(ConstatFinalUtil.class);
	//配置json信息
	public static JSONObject JSONObject = new JSONObject();
	//INFO
	public static JSONObject INFO_JSON = new JSONObject(); 
	/* 存储随机数的字母表 */
	public static String ALLSTR = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	
	/* 静态代码块:初始化一次 */
	static
	{
		/* 读取JSON配置文件 */
		FileUtil fileUtil = new FileUtil();
		try
		{
			String resourceStr = fileUtil.readFile(ConstatFinalUtil.class.getClassLoader().getResourceAsStream("resourceInfo.json"));
			JSONObject = (JSONObject) JSON.parse(resourceStr);
			
			/* 获取json配置文件中info信息 */
			INFO_JSON = JSONObject.getJSONObject("info");
			ConstatFinalUtil.LOGGER.info("JSON配置文件");
		} catch (Exception e)
		{
			ConstatFinalUtil.LOGGER.info("JSON配置文件转换报错了",e);
		}
	}
}
